import {createRouter,createWebHashHistory} from 'vue-router';

//制定路由规则
//定义路由关系
const routes= [
    { path: '/login', name:"login", component: import('@/views/Login.vue') },
    {
        path:'/',
        name:'main',
        component:()=>import('@/views/Main.vue'),
        redirect: '/home',
        children:[
            {
                path:'/home',
                name:'home',
                component:()=>import('@/views/Home.vue'),
            },
            {
                path:'/user',
                name:'user',
                component:()=>import('@/views/User.vue'),
            },
            {
                path:'/mall',
                name:'mall',
                component:()=>import('@/views/mall.vue'),
            }
        ]
    }
]
//创建路由器
const router=createRouter({
    history:createWebHashHistory(),
    routes,
});
//向外界暴露路由
export default router;